import 'package:get/get.dart';
import 'package:ljy_p_app/home/widget/lj_home.dart';
import 'package:ljy_p_app/launch/widget/lj_welcome.dart';
import 'package:ljy_p_app/login/widget/lj_login.dart';
import 'package:ljy_p_app/model/common_list_datatype.dart';
import 'package:ljy_p_app/pages/common/common_list_page.dart';
import 'package:ljy_p_app/pages/common/user_profile_info.dart';

class LjRoutes {
  static const String welcome = '/';
  static const String login = '/login';
  static const String home = '/home';
  static const String history = '/history';

  ///定义路由
  static List<GetPage>? getPages = [
    // 1.欢迎
    GetPage(name: welcome, page: () => LjWelcome()),
    // 2.登录
    GetPage(name: login, page: () => LjLoginPage()),
    // 3.首页
    GetPage(name: home, page: () => LjHomePage()),
    // 4.历史记录
    GetPage(name: history, page: () {
      final args = Get.arguments as Map<String, dynamic>?;
      if (args != null) {
        String? title = args['title'];
        String showType = args['showType'];
        CommonListDatatype dataType = args['dataType'];
        String? userName = args['userName'];
        String? reposName = args['reposName'];
        return CommonListPage(title, showType, dataType, userName: userName, reposName: reposName);
      } else {
        return CommonListPage("", "", CommonListDatatype.follower);
      }
    }),
    // 5.个人中心
    GetPage(name: '/profileInfo', page: () => UserProfileInfo()),
  ];
}